#ifndef QSEARCHALGO_IHM
#define QSEARCHALGO_IHM
#include "qbddmanager.h"
class QAlgoSearch
{
public:
   QAlgoSearch(){};
   virtual ~QAlgoSearch(){};

   virtual QList<QBDDItem*> search(const QList<QStringList>& terms, const quint32& maxTerms) = 0; 
private:
};


class QSearchR : public QAlgoSearch
{
public:
	QSearchR():QAlgoSearch(){};
   ~QSearchR(){};

   virtual QList<QBDDItem*> search(const QList<QStringList>& terms, const quint32& maxTerms)
	{ 
		QList<QResistorItem*> resistors = SEARCH_DB_R(terms,maxTerms);
		QList<QBDDItem*> items;
		
		foreach(QResistorItem* r, resistors)
			items << (QBDDItem*) r;
		return items;
	}
private:
};

class QSearchC : public QAlgoSearch
{
public:
   QSearchC():QAlgoSearch(){};
   ~QSearchC(){};

   virtual QList<QBDDItem*> search(const QList<QStringList>& terms, const quint32& maxTerms) 
	{ 
		QList<QCapacitorItem*> capas = SEARCH_DB_C(terms,maxTerms);
		QList<QBDDItem*> items;
		
		foreach(QCapacitorItem* c, capas)
			items << (QBDDItem*) c;
		return items;
	}
private:
};

class QSearchS : public QAlgoSearch
{
public:
   QSearchS():QAlgoSearch(){};
   ~QSearchS(){};

	virtual QList<QBDDItem*> search(const QList<QStringList>& terms, const quint32& maxTerms) 
	{ 
		QList<QSelfItem*> selfs = SEARCH_DB_L(terms,maxTerms);
		QList<QBDDItem*> items;
		
		foreach(QSelfItem* s, selfs)
			items << (QBDDItem*) s;
		return items;
	}
private:
};

class QSearchLed : public QAlgoSearch
{
public:
   QSearchLed():QAlgoSearch(){};
   ~QSearchLed(){};

   virtual QList<QBDDItem*> search(const QList<QStringList>& terms, const quint32& maxTerms)	
   { 
		QList<QLedItem*> leds = SEARCH_DB_LED(terms,maxTerms);
		QList<QBDDItem*> items;
		
		foreach(QLedItem* d, leds)
			items << (QBDDItem*) d;
		return items;
	}
private:
};

class QSearchOther : public QAlgoSearch
{
public:
   QSearchOther():QAlgoSearch(){};
   ~QSearchOther(){};

   virtual QList<QBDDItem*> search(const QList<QStringList>& terms, const quint32& maxTerms) { return SEARCH_DB_OTHER(terms,maxTerms); } 
private:
};

class QSearchAll : public QAlgoSearch
{
public:
   QSearchAll():QAlgoSearch(){};
   ~QSearchAll(){};

   virtual QList<QBDDItem*> search(const QList<QStringList>& terms, const quint32& maxTerms) { return SEARCH_DB_ALL(terms.first(),maxTerms); } 
private:
};

#endif